package com.my.jli.Service.impl;

import com.my.jli.Service.TeacherService;
import com.my.jli.dao.TeacherRepository;
import com.my.jli.entity.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @ClassName TeacherServiceImpl
 * @Description
 * @Author MaYu
 * @Date 2022/1/27 19:27
 * @Version 1.0
 **/
@Service
public class TeacherServiceImpl implements TeacherService {

    private TeacherRepository teacherRepository;
    @Autowired
    public void setTeacherRepository(TeacherRepository teacherRepository) {
        this.teacherRepository = teacherRepository;
    }

    @Override
    @Transactional(readOnly = true)
    public List<Teacher> getAll() {
        return teacherRepository.findAll();
    }

    @Override
    @Transactional(readOnly = true)
    public List<Teacher> findByNumAndPwd(String num, String pwd) {
        return teacherRepository.findByNumAndPwd(num, pwd);
    }
}
